/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package LiveReservations.dao;

import LiveReservations.model.business.ABusiness;
import LiveReservations.model.business.Business;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Prosomoiwsh vashs me mia lista twn epixeirhsewn
 * @author Alexei
 */
public class SearchBusinessDaoMock implements ISearchBusinessDao
{

    private final List<ABusiness> businessList;
    private ABusiness busObj;
   
    public SearchBusinessDaoMock()
    {
        //HACK : na vrethei tropos na min gnorizei gia to Business
        this.businessList = new ArrayList<>();
        
        this.businessList.add(new Business("RantevouSerres",150));
        this.businessList.add(new Business("Avisinia",50));
        this.businessList.add(new Business("KaphlioTouMitsou",50));
        this.businessList.add(new Business("KaphlioTouKwsta",50));
        this.businessList.add(new Business("KaphlioTouKaphliou",50));
    }
    
    //TODO : Ylopoihsh sigkrisis kai afaireshs apo businessList
    @Override
    public List<ABusiness> getResults(ABusiness queryBusiness)
    {
        String queryName = queryBusiness.getName();
        List<ABusiness> returnList = new ArrayList<>();
        
        //iterate tin lista kai opoio stoixeio dn tairiazei me to query afaireitai
        Iterator<ABusiness> BusinessIterator = businessList.iterator();
        while (BusinessIterator.hasNext())
        {
            this.busObj = BusinessIterator.next();
            if(this.busObj.getName().toLowerCase().contains(queryName.toLowerCase()))
            {
                returnList.add(busObj);
            }
        }
        return returnList;
    }
    
}
